#! /usr/bin/perl

#--------------------------------------------------
# This script will grab the cust_id part from
# a payorintel input data file:
#   payorintel_mmddyy_0000id_insacct.gpg
#--------------------------------------------------

if ( @ARGV != 1 ) {
	usage();
	print "-1";
}

my $id = $ARGV[0];
$id =~ s#^.*/##;
$id =~ s/^payorintel_//;
if( $id =~ /^\d{6}_\d{6}_(\d{6})_(insacct|trans)\.[gp]{3}/i )
{
	$id = $1;
	$id =~ s/^0*(\d+)$/$1/;
	print "$id";
}
else {
	print "-1";
}




sub usage {
	print STDERR "$0 payorintel_mmddyy_<00id>_insacct.gpg\n";
}


